package cn.txauction.common.utils;

import java.io.OutputStream;

import jxl.Workbook;
import jxl.write.WritableFont;

public class JxlExcelBean {
	public JxlExcelBean(){}
	  public String expordExcel(OutputStream os)throws Exception{
	    jxl.write.WritableWorkbook wbook = Workbook.createWorkbook(os); //建立excel文件
	    String tmptitle = "测试文件"; //标题
	    jxl.write.WritableSheet wsheet = wbook.createSheet("第一页", 0); //sheet名称
	    //设置excel标题
	    jxl.write.WritableFont wfont = new jxl.write.WritableFont(
	        WritableFont.ARIAL, 16,
	        WritableFont.BOLD, false, jxl.format.UnderlineStyle.NO_UNDERLINE,
	        jxl.format.Colour.BLACK);
	    jxl.write.WritableCellFormat wcfFC = new jxl.write.WritableCellFormat(
	        wfont);
	    jxl.write.Label wlabel1;
	    wlabel1 = new jxl.write.Label(5, 0, tmptitle, wcfFC);
	    wsheet.addCell(wlabel1);
	    wfont = new jxl.write.WritableFont(
	        WritableFont.ARIAL, 14,
	        WritableFont.BOLD, false, jxl.format.UnderlineStyle.NO_UNDERLINE,
	        jxl.format.Colour.BLACK);
	    wcfFC = new jxl.write.WritableCellFormat(
	        wfont);
	    jxl.write.Label wlabel;
	    wlabel = new jxl.write.Label(0, 0, "写入内容");
	    wsheet.addCell(wlabel); //
	    wbook.write(); //写入文件
	    wbook.close();
	    os.close();
	    return "success";
	  }

}
